package com.i8office.android.zhihuixinwu.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.ViewGroup;
import android.widget.TextView;

import com.cyan.tools.base.BaseViewHolder;
import com.cyan.tools.base.RecyclerArrayAdapter;
import com.i8office.android.zhihuixinwu.R;

import bean.WorkFlow;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by pc on 2018/7/7.
 */

public class OfficeAdapter extends RecyclerArrayAdapter<WorkFlow> {
    public OfficeAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new ViewHolder(parent);
    }

    class ViewHolder extends BaseViewHolder<WorkFlow> {
        @BindView(R.id.title)
        TextView title;
        @BindView(R.id.content)
        TextView content;
        @BindView(R.id.date)
        TextView date;

        public ViewHolder(ViewGroup parent) {
            super(parent, R.layout.item_deal);
            ButterKnife.bind(this, itemView);
        }

        @Override
        public void setData(WorkFlow data) {
            title.setText(data.getDocumentTitle());
            content.setText(data.getSequenceName() + " " + data.getSequenceNumber());
            date.setText(TextUtils.isEmpty(data.getClosedOrHairTime()) ? "" : data.getClosedOrHairTime().substring(0, 10));
        }
    }
}
